package cn.aitrox.ry.service.auth.dao.impl;

import cn.aitrox.ry.common.dao.MapperSqlCallback;
import cn.aitrox.ry.common.dao.impl.BaseDaoImpl;
import cn.aitrox.ry.service.auth.dao.AuthRoleDao;
import cn.aitrox.ry.service.auth.entity.AuthRoleEntity;
import cn.aitrox.ry.service.auth.mapper.AuthRoleMapper;
import cn.aitrox.ry.service.auth.po.role.RoleQueryParamPo;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class AuthRoleDaoImpl extends BaseDaoImpl<AuthRoleEntity> implements AuthRoleDao {

    @Autowired
    private AuthRoleMapper mapper;

    @Override
    public PageInfo<AuthRoleEntity> searchByParam(Integer page, Integer pageSize, RoleQueryParamPo roleQueryParamPo) {
        return super.searchByCustom(page, pageSize, new MapperSqlCallback<AuthRoleEntity>() {
            @Override
            public List<AuthRoleEntity> invoke() {
                return mapper.query(roleQueryParamPo);
            }
        });
    }
}
